import request from '@/utils/request'

export function getList(params) {
  return request({
    url: '/core/app/list',
    method: 'get',
    params
  })
}

export const del = (id) => request.delete('/core/app/del?appId=' + id, {

})
export const add = (data) => request({
  url: '/core/app/create',
  method: 'post',
  data: data
})

export const update = (params,data) => request({
  url: '/core/app/update',
  method: 'put',
  params,
  data:data
})

//获取appId对应的应用详情
export const detail = (params) => request({
    url: '/core/app/detail',
    method: 'get',
    params
  })

  //Dataset获取知识库
  export const dataset = () => request({
    url: '/core/dataset/allDataset',
    method: 'get'
  })

  //应用配置保存
  export const fastgpt_universal = (data) => request({
    url: '/core/app/form2Modules/fastgpt-universal',
    method: 'post',
    data: data
  })

  //预览对话
  export const chatTest = (data) => request({
    url: '/core/chat/chatTest',
    method: 'post',
    data: data
  })

  //获取历史对话内容
  export const chatHistories = (data) => request({
    url: '/core/chat/getHistories',
    method: 'post',
    data: data
  })

  //获取对话信息
  export const chatInit = (params) => request({
    url: '/core/chat/init',
    method: 'get',
    params
  })

  //对话
  export const completions = (data) => request({
    url: '/v1/chat/completions',
    method: 'post',
    data: data
  })
